<script setup lang="ts">
import { ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { listServices } from '@/apis/services';

const content = ref<any>(null);
const route = useRoute();

// interface Props {
//     data: {
//         helpInfoId?: string;
//         helpInfoContent?: string;
//     }[];
//     console.log('获取到内容了',data)
// }
// withDefaults(defineProps<Props>(), {
//     data: () => [],
// });

// 监听 route.query.type 的变化
watch(() => route.query.type, async (type) => {
  if (type) {
    const { data } = await listServices({
      data: {
        type: type,
        pType: '1',
      },
    });
    content.value = data;
    console.log('获取到内容了',content.value)
  }
}, {
  immediate: true, // 立即执行一次
});

</script>
<template>
    <div class="py-12 px-80">
        <template v-for="item in content" :key="item.helpInfoId">
            <div v-html="item.helpInfoContent"></div>
        </template>
    </div>
</template>

<style lang="scss" scoped>
:deep(img) {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
</style>
